package com.niit.service;

import com.niit.model.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * Feign注解式开发，将接口与服务提供方的对应，然后提供给Controller
 */
@FeignClient(value = "student-provider", fallbackFactory = StudentFallbackFactory.class)
public interface StudentService {
    @GetMapping("/class/{id}")
    List<Classes> getClassById(@PathVariable("id") Long id);

    @DeleteMapping("/class/{id1}/{id2}")
    String deleteClassById(@PathVariable("id1") Long id1, @PathVariable("id2") Long id2);

    @GetMapping("exampaperl/{id}")
    List<ExamPaper> list(@PathVariable("id") Long id);

    @GetMapping("exampaperl1/{id}")
    List<ExamPaper> list1(@PathVariable("id") Long id);

    @GetMapping("exampaperl2/{id}")
    List<ExamPaper> list2(@PathVariable("id") Long id);

    @GetMapping("/exampaper/{id}")
    ExamPaper getExamPaperById(@PathVariable("id") Long id);

    @GetMapping("/exampaper1/{id}")
    ExamPaper getExamPaperById1(@PathVariable("id") Long id);

    @GetMapping("/exampaper2/{id}")
    ExamPaper getExamPaperById2(@PathVariable("id") Long id);

    @GetMapping("/student/{id}")
    Student getStudentById(@PathVariable("id") Long id);

    @PutMapping("/student")
    String update(@RequestBody Student student);

    @GetMapping("/paper/{id}")
    List<StudentPaper> selectStudentPaperById(@PathVariable("id") Long id);

    @GetMapping("studentpaper")
    List<StudentPaper> list(StudentPaper studentPaper);

    @PostMapping("/testIn")
    String add(@RequestBody StudentPaperQuestionAnswer studentPaperQuestionAnswer);

    @PutMapping("/testIn")
    String update(@RequestBody StudentPaperQuestionAnswer studentPaperQuestionAnswer);

    @GetMapping("/testIn/{id1}/{id2}")
    StudentPaperQuestionAnswer select1(@PathVariable("id1") Long id1, @PathVariable("id2") Long id2);

    @GetMapping("/paperQuestion/{id1}/{id2}")
    PaperQuestion select(@PathVariable("id1") Long id1, @PathVariable("id2") Long id2);

    @GetMapping("/studentclass/{id1}/{id2}")
    int addStudentClassById(@PathVariable("id1") Long id1, @PathVariable("id2") Long id2);

    @GetMapping("/testInp/{id2}}")
    List<StudentPaperQuestionAnswer> selectForPaper(@PathVariable("id2") Long id2) ;
}

